package cn.edu.sdjzu.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@WebFilter(filterName = "Filter 1",urlPatterns = {"/*"})
public class Filter1 implements Filter {
    public void destroy(){}
    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) req;
        String path = request.getRequestURI();
        System.out.println("请求的资源为："+path);
        System.out.println("Filter 1 begins");
        chain.doFilter(req,resp);
        System.out.println("Filter 1 ends");
    }
    public void init(FilterConfig config)throws ServletException{}
}
